<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%
    response.setHeader("cache-control","public");
    String path = request.getContextPath();
    String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort() + path + "/";
%>

<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="renderer" content="webkit">
    <title>在线考试系统</title>
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/bootstrap.css">
    <!--[if IE 7]><link rel="stylesheet" href="<%=path%>/static/css/font/font-awesome-ie7.min.css"><![endif]-->
    <link rel="stylesheet" type="text/css" href="<%=path%>/static/css/common.css">
    <link type="text/css" rel="stylesheet" href="<%=path%>/static/css/examMng/core.css"/>
    <link rel="stylesheet" href="<%=path%>/static/css/examMng/examMng.css"/>
    <script src="<%=path%>/static/js/respond.js"></script>
    <script src="<%=path%>/static/js/jquery-1.9.1.min.js"></script>
    <script src="<%=path%>/static/js/jquery-2.0.3.min.js"></script>
    <script type="text/javascript" src="<%=path%>/static/js/bootstrap.min.js"></script>
</head>
<body>

<jsp:include page="../head.jsp" flush="true"/>

<!--body begin-->
<div class="main-container">
    <div class="container info-add body-box">
        <div class="info-add-box" style="background: #4c4ca6;">
            <p>试题类型：</p>
            <a href="javascript:history.go(-1);"><i class="glyphicon glyphicon-arrow-left"></i>&nbsp;返回</a>
        </div>
        <div class="additem-main">
            <div class="additem-caption-box">
                <p class="additem-caption">${content.title }</p>
            </div>
            <div class="additem-content">
                <c:forEach items="${typeList }" var="type">
						<a href="javascript:doPost('<%=basePath %>depository/toCheckQuestion','${content.id }','${type.typeId}','${type.typeCount }')">
                        <div class="firstbox" style="margin-top: 30px;">
                            <div class="additem-content-title">${type.typeName }</div>
                            <div class="dottedline"></div>
                            <div class="additem-content-num">${type.typeCount }</div>

                        </div>
                    </a>
                </c:forEach>
            </div>
        </div>
    </div>
</div>

<script>
    $(function () {
        // $('#topMain').children().eq(4).addClass('active'); // 追加样式;

        //试卷管理
        if (${role eq 'master'}) {
            $('#topMain').children().eq(0).addClass('active'); // 追加样式;
            $('#topMain').children().eq(0).children().attr('href', '#');
        } else if (${role eq 'trainee'}) {
            $('#topMain').children().eq(0).addClass('active'); // 追加样式;
            $('#topMain').children().eq(0).children().attr('href', '#');
        } else {
            $('#topMain').children().eq(3).addClass('active'); // 追加样式;
            // $('#topMain').children().eq(3).children().attr('href', '#');
        }

    })

    var nums = 0;
    $(document).ready(function () {
        nums = $(".main-container .info-add").length;
        footer_position();
        //当浏览器窗口大小改变时，设置显示内容的高度
        $(window).resize(function () {
            footer_position();
        });
    });

    function footer_position() {
        var winHeight = $(window).height();
        var myHeight = winHeight - 60 - 82 - 20;
        //alert(myHeight+"-"+$(".main").height());
        if ($(".main-container").height() <= myHeight) {
            $(".kw-footer").css("position", "fixed");
            $(".kw-footer").css("bottom", "0");
            $(".main-container").css("min-height", myHeight + "px");
        } else {
            $(".kw-footer").css("position", "initial");
        }
    }

    function doPost(to, p,l,c) {  // to:提交动作（action）,p:参数  
		//var typeCount = ${type.typeCount };
        var myForm = document.createElement("form");       
        myForm.method = "post";  
        myForm.action = to;  
        var myInput = document.createElement("input");  
        myInput.setAttribute("name", "ConId");  // 为input对象设置name  
        myInput.setAttribute("value", p);  // 为input对象设置value 
        myForm.appendChild(myInput);
        var myInput2 = document.createElement("input");  
        myInput2.setAttribute("name", "typeId");  // 为input对象设置name  
        myInput2.setAttribute("value", l);  // 为input对象设置value  
        myForm.appendChild(myInput2);
        var myInput3 = document.createElement("input");  
        myInput3.setAttribute("name", "page_num");  // 为input对象设置name  
        myInput3.setAttribute("value", 0);  // 为input对象设置value
        myForm.appendChild(myInput3);
        var myInput4 = document.createElement("input");  
        myInput4.setAttribute("name", "page_size");  // 为input对象设置name  
        myInput4.setAttribute("value", 5);  // 为input对象设置value  
        myForm.appendChild(myInput4);
        var myInput5 = document.createElement("input");  
        myInput5.setAttribute("name", "typeCount");  // 为input对象设置name  
        myInput5.setAttribute("value", c);  // 为input对象设置value  
        myForm.appendChild(myInput5);
        document.body.appendChild(myForm);     
        myForm.submit();   
        document.body.removeChild(myForm);  // 提交后移除创建的form    
	}
</script>
<!--body end-->

</body>
</html>

